import { Component } from 'vue'

export type ITaskState =
  | 'SUBMITTED_SUCCESS'
  | 'RUNNING_EXECUTION'
  | 'READY_PAUSE'
  | 'PAUSE'
  | 'READY_STOP'
  | 'STOP'
  | 'FAILURE'
  | 'SUCCESS'
  | 'NEED_FAULT_TOLERANCE'
  | 'KILL'
  | 'WAITING_THREAD'
  | 'WAITING_DEPEND'
  | 'DELAY_EXECUTION'
  | 'FORCED_SUCCESS'
  | 'SERIAL_WAIT'
  | 'DISPATCH'
  | 'PENDING'

export type ITaskStateConfig = {
  [key in ITaskState]: {
    id: number
    desc: string
    color: string
    icon: Component
    isSpin: boolean
    classNames?: string
  }
}

import type {
  TableColumns,
  InternalRowData
} from 'naive-ui/es/data-table/src/interface'

type TUserType = 'GENERAL_USER' | ''
type TAuthType =
  | 'authorize_project'
  | 'authorize_resource'
  | 'authorize_datasource'
  | 'authorize_udf'
  | 'authorize_namespace'

interface IRecord {
  id: number
  userName: string
  userType: TUserType
  tenantCode: string
  tenantId: null | number
  queueName: string
  email: string
  phone: string
  state: 0 | 1
  createTime: string
  updateTime: string
}

interface IResourceOption {
  id: number
  fullName: string
  type: string
}

interface IOption {
  value: number
  label: string
}

export {
  IRecord,
  IResourceOption,
  IOption,
  TAuthType,
  TableColumns,
  InternalRowData
}
